import {configureStore} from '@reduxjs/toolkit'
import counterReducer from './modules/demo'
import {TypedUseSelectorHook, useDispatch, useSelector} from 'react-redux'
const store = configureStore({
  reducer: {
    counter: counterReducer
  }
})
type GetStateFnType = typeof store.getState
export type IRootState = ReturnType<GetStateFnType>
type DispatchType = typeof store.dispatch
// 函数调用签名
export const useAppDispatch :()=> DispatchType  = useDispatch
export const useAppSelector: TypedUseSelectorHook<IRootState> = useSelector
export default store